﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace DataChangeTools.Models
{
    public class BatchRenameModel : INotifyPropertyChanged
    {
        public string Id { get; set; }


        private string code;
        public string Code
        {
            get { return code; }
            set
            {
                Set(ref code, value);
                if (!string.IsNullOrEmpty(value))
                {
                    State = 1;
                }
                else
                {
                    State = 0;
                }
            }
        }

        public string FileName { get; set; }

        public string Image { get; set; }

        private int state;

        public int State
        {
            get { return state; }
            set { Set(ref state, value); }
        }


        private double itemWidth = 200;

        public double ItemWidth
        {
            get { return itemWidth; }
            set { Set(ref itemWidth, value); }
        }

        private double itemHeight = 200;

        public double ItemHeight
        {
            get { return itemHeight; }
            set { Set(ref itemHeight, value); }


        }

        public event PropertyChangedEventHandler PropertyChanged;

        protected void Set<T>(ref T item, T value, [CallerMemberName] string propertyName = null)
        {
            if (!EqualityComparer<T>.Default.Equals(item, value))
            {
                item = value;
            }
            OnPropertyChanged(propertyName);
        }

        protected void OnPropertyChanged([CallerMemberName] string propertyName = null) =>
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));

    }
}
